﻿@using Kovan.Library.Extensions;
@using Kovan.Model.Parameter.Config;
@using Kovan.Model.Entity.Config;
@{
    ViewBag.Title = "上传照片";
    var Item = Model as tb_picgroup;
    var param = ViewBag.Param as PPicture;
    var Items = ViewBag.pictures as List<tb_picture>;
}
<form id="pagerForm" method="post" action="@Url.Content("~/Manage/PicGroup/Picture")">
<input type="hidden" name="PageIndex" value="@param.PageIndex" />
<input type="hidden" name="PageSize" value="@param.PageSize" />
<input type="hidden" id="picgroupId" name="picgroupId" value="@param.picgroupId" />
</form>
<div class="pageHeader">
    <form onsubmit="return PicGroupManage.SavePicGroup(this, PicGroupManage.dialogSavePicgroupDone);" action="@Url.Content("~/Manage/PicGroup/SavePicGroup")" method="post">
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <td>
                    相册名称：<input type="text" name="name" value="@Item.name" />
                    <input type="hidden" name="picgroup_id" value="@Item.picgroup_id" />
                </td>
                <td>
                    排序：<input type="text" name="sort_order" value="@Item.sort_order" />
                </td>
                <td>
                    <label>
                        首页可见：<input type="checkbox" name="is_index" value="1" @(Item.is_index == 1 ? "checked" : "")/></label>
                </td>
                <td>
                    <label>
                        是否显示：<input type="checkbox" name="is_view" value="1"  @(Item.is_view == 1 ? "checked" : "")/></label>
                </td>
            </tr>
        </table>
        <div class="subBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">
                                保存</button></div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="@Url.Content(string.Format("~/Manage/PicGroup/GetUpload?pgid={0}", Item.picgroup_id))" target="dialog" width="500" height="300" mask="true">
                <span>上传照片</span></a></li>
            <li><a class="delete" href="javascript:;" onclick="PicGroupManage.DeletePicture();">
                <span>删除相片</span></a></li>
            <li><a class="edit" href="@Url.Content("~/Manage/PicGroup/GetOperate?id=" + Item.picgroup_id)" target="dialog" rel="picgroup_operate" mask="true"  width="820" height="320" title="修改相册">
                <span>修改相册</span></a></li>
        </ul>
    </div>
    <div layouth="116">
        @if (Items != null && Items.Count > 0)
        {
            foreach (var p in Items)
            {
            <div class="photo_box">
                <a  href="@Url.Content(string.Format("~/content/UpLoads/pic/{0}/{1}", Item.ukey, p.path))" class="highslide" onclick="return hs.expand(this)">
                    <p style="width: 90%; height: 80%; margin: 0 auto; overflow: hidden;">
                        <img src="@Url.Content(string.Format("~/content/UpLoads/pic/{0}/{1}", Item.ukey, p.small_path))" />
                    </p>
                </a>
                <div class="highslide-caption" style="text-align: left; line-height: 20px;">
                    <b>标题：</b>@p.title<br />
                    @if (!string.IsNullOrEmpty(p.description))
                    {
                        <b>描述:</b>@p.description
                    }
                </div>
                <p style="width: 90%; height: 9%; margin: 0 auto;">
                    <span style="line-height: 30px;">
                        <input type="checkbox" name="pids" value="@p.picture_id" />&nbsp;<a title="修改相片信息" href="@Url.Content("~/Manage/PicGroup/GetPictureOperate?id=" + p.picture_id)" rel="picture_operate" target="dialog" width="820" height="320" mask="true">@p.title</a></span>
                </p>
                <p style="width: 90%; height: 9%; text-align: right; margin: 0 auto;">
            </div>
            
            }
        }
    </div>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            <select class="combox" name="PageSize" onchange="dialogPageBreak({numPerPage:this.value})">
                <option value="10" @(param.PageSize == 10 ? "selected=selected" : "")>10</option>
                <option value="20" @(param.PageSize == 20 ? "selected=selected" : "")>20</option>
                <option value="50" @(param.PageSize == 50 ? "selected=selected" : "")>50</option>
                <option value="100" @(param.PageSize == 100 ? "selected=selected" : "")>100</option>
                <option value="200" @(param.PageSize == 200 ? "selected=selected" : "")>200</option>
            </select>
            <span>条，共 @param.TotalRows 条</span>
        </div>
        <div class="pagination" targettype="dialog" totalcount="@param.TotalRows" numPerPage="@param.PageSize" pagenumshown="10"
            currentpage="@param.PageIndex">
        </div>
    </div>
</div>
<script type="text/javascript">
    hs.graphicsDir = System_Path + 'Scripts/highslide/graphics/';
    hs.align = 'center';
    hs.transitions = ['expand', 'crossfade'];
    //hs.outlineType = 'rounded-white';
    //hs.wrapperClassName = 'dark borderless floating-caption';
    hs.fadeInOut = true;
    //hs.numberPosition = 'caption';
    hs.dimmingOpacity = 0.75;

    // Add the controlbar
    if (hs.addSlideshow) hs.addSlideshow({
        //slideshowGroup: 'group1',
        interval: 5000,
        repeat: false,
        useControls: false,
        fixedControls: 'fit',
        overlayOptions: {
            opacity: 0.75,
            position: 'bottom left',
            hideOnMouseOut: true
        }
    });
</script>
